#include <REGX52.H>
#include "Delay.h"
#include "KEYNUMBER.h"
#include "TIMER0.h"
#include "Nixie.h"

sbit out1=P1^3;
unsigned char Timer0_cout=0;
unsigned char compare=0;
int main()
{
	unsigned char key=0;
	unsigned char num=0;
	Timer0_Init();
	while(1)
	{
		key= Key_Number();
		if(key!=0)
		{
			num=key;
		}
		if(key==1)
			{
				compare=0;
			}
			else if(key==2)
			{
				compare=40;
			}
			else if(key==3)
			{
				compare=75;
			}
			else if(key==4)
			{
				compare=100;
			}
		DisplayBoard(1,num,' ');

	}
	return 0;
}

void Timer0_interrupt() interrupt 1
{
	TL0 = 0xA4;		//设置定时初值
	TH0 = 0xFF;		//设置定时初值
	Timer0_cout++;
	Timer0_cout%=100;
	if(Timer0_cout>compare)
	{
		out1=0;//停止
	}
	else
	{
		out1=1;//启动
	}
}